home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Macintosh CD: Powe…osh 6100/7100/8100 Series
/
Apple Macintosh CD - Power Macintosh 6100, 7100, 8100 series.7z
/
Apple Macintosh CD - Power Macintosh 6100, 7100, 8100 series.bin
/
Power Macintosh Demo Apps
/
Segue
/
DEMO
/
demo.inc
next >
Wrap
Text File
|
1994-01-12
|
10KB
|
255 lines
/*
** demo.inc
**
** Window declarations and functions for Text Editor.
**
** Copyright (c) 1992-1994 by Segue Software, Inc.
** All Rights Reserved.
*/
/*******************************************************************************
** **
** MENU ITEM DECLARATIONS **
** **
*******************************************************************************/
window MainWin TextEditor
{
tag "[TextEdit]Text Editor - *";
mac tag "#1";
SysMenu SysMenu
{
mac MenuItem TextEditor { tag "Text*Edit*"; }
}
Menu File
{
tag "File";
MenuItem New { tag "New"; }
MenuItem Open { tag "Open"; }
MenuItem Save { tag "Save"; }
MenuItem SaveAs { tag "Save As"; }
MenuItem Exit { tag "Exit";
mac tag "Quit"; }
}
Menu Edit
{
tag "Edit";
MenuItem Undo { tag "Undo"; }
MenuItem Cut { tag "Cut"; }
MenuItem Copy { tag "Copy"; }
MenuItem Paste { tag "Paste"; }
MenuItem Delete { tag "Delete";
mac tag "Clear"; }
}
Menu Search
{
tag "Search";
MenuItem Find { tag "Find"; }
MenuItem FindNext { tag "Find Next"; }
MenuItem Replace { tag "Replace"; }
MenuItem GotoLine { tag "Goto Line"; }
}
Menu Help
{
tag "Help";
MenuItem About { tag "About"; }
}
mac AppleMenu Help
{
MenuItem About { tag "About"; }
}
TextField Document { tag "#1"; }
}
/*******************************************************************************
** **
** DIALOG BOX DECLARATIONS **
** **
*******************************************************************************/
window DialogBox Open
{
msw tag "Open";
mac tag "#1";
motif tag "File Open";
msw parent TextEditor;
motif parent TextEditor;
motif StaticText FilterText { tag "Filter"; }
motif TextField Filter { tag "Filter"; }
StaticText FileNameText { tag "File Name:";
motif tag "Selection"; }
TextField FileName { tag "File Name:";
motif tag "Selection"; }
ListBox Files { tag "#1"; }
PushButton OK { tag "OK";
mac tag "Open"; }
PushButton Cancel { tag "Cancel"; }
motif PushButton FilterButton { tag "Filter"; }
}
window DialogBox SaveAs
{
msw tag "Save As";
mac tag "#1";
motif tag "File Save As";
msw parent TextEditor;
motif parent TextEditor;
motif StaticText FilterText { tag "Filter"; }
motif TextField Filter { tag "Filter"; }
StaticText FileNameText { msw tag "File Name:";
mac tag "Save As:";
motif tag "Selection"; }
TextField FileName { msw tag "File Name:";
mac tag "#1";
motif tag "Selection"; }
ListBox Files { tag "#1"; }
PushButton OK { tag "OK";
mac tag "Save"; }
PushButton Cancel { tag "Cancel"; }
motif PushButton FilterButton { tag "Filter"; }
}
window DialogBox Find
{
tag "Find";
msw parent TextEditor;
motif parent TextEditor;
StaticText FindWhatText { tag "Find What:"; }
TextField FindWhat { tag "Find What:"; }
StaticText DirectionText { tag "Direction"; }
RadioButton Up { tag "Up"; }
RadioButton Down { tag "Down"; }
PushButton FindNext { tag "Find Next"; }
PushButton Cancel { tag "Cancel";
mac tag "Done"; }
}
window DialogBox Replace
{
tag "Replace";
msw parent TextEditor;
motif parent TextEditor;
StaticText FindWhatText { tag "Find What:"; }
TextField FindWhat { tag "Find What:"; }
StaticText ReplaceWithText { tag "Replace With:"; }
TextField ReplaceWith { tag "Replace With:";
motif tag "#2"; }
StaticText DirectionText { tag "Direction"; }
RadioButton Up { tag "Up"; }
RadioButton Down { tag "Down"; }
PushButton FindNext { tag "Find Next"; }
PushButton Replace { tag "Replace"; }
PushButton ReplaceAll { tag "Replace All"; }
PushButton Cancel { tag "Cancel";
mac tag "Done"; }
}
window DialogBox GotoLine
{
tag "Goto Line";
msw parent TextEditor;
motif parent TextEditor;
StaticText LineText { tag "Line:"; }
TextField Line { tag "Line:"; }
PushButton OK { tag "OK"; }
PushButton Cancel { tag "Cancel"; }
}
window DialogBox About
{
tag "About";
mac tag "#1";
msw parent TextEditor;
motif parent TextEditor;
StaticText TextEditorText { tag "Text Editor"; }
PushButton OK { tag "OK"; }
}
/*******************************************************************************
** **
** ADDITIONAL DECLARATIONS **
** **
*******************************************************************************/
window DialogBox MessageBox
{
msw tag "../[DialogBox]#1";
mac tag "#1";
motif tag "[DialogBox]#1";
motif parent TextEditor;
StaticText Message { tag "#1"; }
PushButton No { tag "No"; }
}
/******************************************************************************/
ScriptEnter ()
{
if (GetGUIType () == GT_MAC) // set Mac current directory
SYS_SetDir ("{SYS_GetDrive ()}:QAPDemo:Demo");
}
/******************************************************************************/
StartEditor ()
{
// start the editor and makes it the active window
string sPath;
switch (GetGUIType ()) {
case GT_MSW: sPath = "{SYS_GetDrive ()}:\qapdemo\demo\textedit.exe";
case GT_MAC: sPath = "{SYS_GetDrive ()}:QAPDemo:Demo:TextEdit";
case GT_MOTIF: sPath = "{SYS_GetEnv ("SEGUE_APPS")}/qapdemo/demo/textedit";
}
APP_Start (sPath); // start the application
if (GetGUIType () == GT_MAC) { // if running on a Mac,
if (TextEditor.SysMenu.TextEditor.Exists ())
TextEditor.SysMenu.TextEditor.Pick (); // make it the active window
}
else // otherwise,
if (TextEditor.Exists ()) // if Text Editor exists
TextEditor.SetActive (); // make it the active window
}
/******************************************************************************/
EndEditor ()
{
// exit the application
WND_SetTrap ("[StaticText]Save File -*", "[PushButton]NO");
APP_Exit (TextEditor.AppId); // exit the application
string sFile; // determine filename by GUI type
if (GetGUIType () == GT_MOTIF)
sFile = "/tmp/temp.txt"; // set variable
else
sFile = "temp.txt";
if (SYS_FileExists (sFile)) // clean up the temp.t file
SYS_RemoveFile (sFile); // if it exists
}